package com.guangyunl.c_array;
// 创建两个数组指向同一个空间，互相影响
public class Demo03Array {
    public static void main(String[] args) {
        int[] arr1 = new int[3];
        System.out.println("arr1 = " + arr1); //地址值
        System.out.println("arr1[1] = " + arr1[1]); // 0
        arr1[1] = 100;
        System.out.println("arr1[1] = " + arr1[1]); // 100
        System.out.println("==============================");

        int[] arr2 = arr1;
        System.out.println("arr2 = " + arr2);
        System.out.println("arr2[1] = " + arr2[1]);
        arr2[1] = 200;

        System.out.println("==============================");

        System.out.println("arr1[1] = " + arr1[1]); // 200
        System.out.println("arr2[1] = " + arr2[1]); // 200

    }
}

/*
arr1 = [I@6d311334
arr1[1] = 0
arr1[1] = 100
==============================
arr2 = [I@6d311334
arr2[1] = 100
==============================
arr1[1] = 200
arr2[1] = 200
 */